package demo01;

public class test {
    public static void Show(Animal animal) {
        animal.eat();
    }
    public static void main(String[] args) {
        Animal animal01 = new Dog();
        Animal animal02 = new Cat();

        Show(animal01);
        Show(animal02);
    }
}

interface Animal {
    void eat();

}

class Dog implements Animal{
    @Override
    public void eat() {
        System.out.println("汪汪");
    }
}

class Cat implements Animal{
    public void eat() {
        System.out.println("喵喵");
    }
}